home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbasicpg.zip
/
FRUITS.BAS
< prev
next >
Wrap
BASIC Source File
|
1989-08-31
|
913b
|
32 lines
' FRUITS.BAS
' This program uses the PRINT# USING statement to send three lines
' of formatted fruit information to a sequential file.
OPEN "FRUITS.TXT" FOR OUTPUT AS #1 ' open file in current drive/dir
CLS
' create a formatting template for the PRINT# USING statement
tmp$ = "Fruit: \ \ Cases: ### Price/pound:$$##.##"
' get some fruit information from the user and write it to the open file
INPUT "Enter your favorite summer fruit: ", fruit$
INPUT "How many cases would you like to purchase? ", cases%
INPUT "How much does it cost per pound? $", cost!
PRINT #1, USING tmp$; fruit$; cases%; cost!
' add some literal values to the file
PRINT #1, USING tmp$; "Strawberry"; 2; 1.29
PRINT #1, USING tmp$; "Cantaloupe"; 14; .69
CLOSE #1 ' close the file
PRINT
PRINT "Information has been successfully written to FRUITS.TXT"